package com.deyuanyun.pic.pipe.controller;

import com.deyuanyun.pic.common.util.ajax.AjaxSupport;
import com.deyuanyun.pic.pipe.service.PiggingStructureService;
import com.deyuanyun.pic.settings.service.pipe.PipeLineService;
import com.deyuanyun.pic.settings.service.pipe.PipeSegmentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

/**
 * 基础数据功能模块
 *
 * @author       // scalpel.王敏
 * @version      // [v1.0] 创建时间（2016/6/12 9:21）
 * @see         // 引用的类
 * Method List:
 *         1.----------------
 *         2.----------------
 * History:                           // 历史修改记录           (如果有修改别人的类，必须)   [修改人][时间][修改描述]
 */

@Controller
public class PipeCommController  {

    @Resource
    private PipeLineService pipeLineService;

    @Resource
    private PipeSegmentService pipeSegmentService;

    /**
     * 得到所有管道信息
     *
     * @return
     */
    @RequestMapping("/comm/pipeLines")
    public ModelAndView getPipeLine() {
        ModelAndView mv = new ModelAndView();
        mv.addObject("result", pipeLineService.getPiPelLine());
        return mv;
    }

    /**
     * 根据管道ID，得到此管线的所有管段信息
     *
     * @param lineId
     * @return
     */
    @RequestMapping("/comm/pipeSegments")
    public ModelAndView getPipeSegment(String lineId) {

        ModelAndView mv = new ModelAndView();
        mv.addObject("result", pipeSegmentService.getSegmentByLineId(lineId));
        return mv;
    }


    @ResponseBody
    @RequestMapping("/comm/getBall.json")
    public void getBall(String lineId,String beginMileage,String endMileage) {

//        AjaxSupport.sendSuccessText("",piggingStructureService.findStructureByLineId(lineId));
    }
}
